package com.bookbuf.biz.stub;

import android.app.Application;
import android.content.Context;

import com.bookbuf.library.domain.User;
import com.bookbuf.module.manager.StubManager;
import com.bookbuf.module.stub.impl.BizProxyStub;

import junit.framework.Assert;

/**
 * author: robert.
 * date :  2016/12/28.
 */

public class StubApplication extends Application {

    public static StubApplication get(Context context) {
        return (StubApplication) context.getApplicationContext();
    }


    @Override
    public void onCreate() {
        super.onCreate();

        // 模拟依赖的数据
        StubManager.getManager().obtain(new BizProxyStub.BizDependence() {
            @Override
            public User injectUser() {
                User user = new User();
                user.setMobile("13555555555");
                user.setName("张乐");
                return user;
            }
        });

        Assert.assertNotNull("stub is null.", StubManager.getManager().obtainPrivate());
    }

}
